//
//  WSJLoginVC.m
//  WSJBaseProject
//
//  Created by wsj2015 on 2016/12/2.
//  Copyright © 2016年 wsj2015. All rights reserved.
//

#import "WSJLoginVC.h"
#import "RuriTextField.h"
#import "IQKeyboardManager.h"
#import "JHChainableAnimations.h"
#import "QQLoginTool.h"
#import "WSJUserTool.h"
#import <TencentOpenAPI/TencentOAuth.h>

@interface WSJLoginVC ()<UITextFieldDelegate,TencentLoginDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *bg_img;

@property (weak, nonatomic) IBOutlet UIButton *qq_btn;

@property (nonatomic,  strong) RuriTextField *accountTf;

@property (nonatomic,  strong) RuriTextField *pwdTf;
@end

@implementation WSJLoginVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.title = @"登录";
    
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
    
    UIVisualEffectView *effectview = [[UIVisualEffectView alloc] initWithEffect:blur];
    
    effectview.frame = self.view.bounds;
    [self.bg_img addSubview:effectview];
    
    self.qq_btn.layer.cornerRadius = 10;
    self.qq_btn.layer.masksToBounds = YES;
    
    [self.view addSubview:self.accountTf];
    [self.view addSubview:self.pwdTf];
    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
     self.qq_btn.makeScale(.5).moveY(100).spring.animate(2.0).thenAfter(.2).makeScale(1.5).spring.animate(.35);
   
 
}
- (RuriTextField *)accountTf{
    if (!_accountTf) {
        _accountTf = [[RuriTextField alloc] initWithFrame:CGRectMake(40, 150, kScreenWidth - 80, 44)];
        _accountTf.delegate =self;
        _accountTf.placeholder = @"请输入手机号";
//        _accountTf.placeholderColor = [UIColor grayColor];
//        _accountTf.activeColor = [UIColor greenColor];
//        _accountTf.placeholderFontScale = 1.2;
//        _accountTf.borderColor = [UIColor blueColor];
        
        
    }
    return _accountTf;
    
}
- (RuriTextField *)pwdTf{
    if (!_pwdTf) {
        _pwdTf = [[RuriTextField alloc] initWithFrame:CGRectMake(40, CGRectGetMaxY(self.accountTf.frame)+30, kScreenWidth - 80, 44)];
        _pwdTf.delegate =self;
        _pwdTf.placeholder = @"请输入密码";
//        _pwdTf.placeholderColor = [UIColor grayColor];
        
//        _pwdTf.placeholderFontScale = 1.2;
//        _pwdTf.borderColor = [UIColor blueColor];
        _pwdTf.secureTextEntry =YES;
        
    }
    return _pwdTf;
    
}
- (IBAction)qqLogin:(id)sender {
    
     [[NSNotificationCenter defaultCenter] postNotificationName:UserLoginNotification object:nil];
    [self dismissViewControllerAnimated:YES completion:nil];
//    
//    [[QQLoginTool sharedTool] loginWithSucess:^(NSDictionary *dict){
//        [[WSJUserTool shareUserTool] creatOrUpdateUser:dict];
//        [[NSNotificationCenter defaultCenter] postNotificationName:UserLoginNotification object:nil];
//    } failBlock:^{
//        
//    }];
   
    
    
}



@end
